/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){

  //  Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';

    
    /*
     * ================  Form 2  =======================
     */

    var fsf = new Ext.FormPanel({
        labelWidth: 75, // label settings here cascade unless overridden
        url:'save-form.php',
        frame:true,
        title: '青少年发展数据录入',
        bodyStyle:'padding:5px 5px 0',
        width: 350,

        items: [{
            xtype:'fieldset',
            checkboxToggle:true,
            title: '人口数据信息',
            autoHeight:true,
            defaults: {width: 210},
            defaultType: 'textfield',
            collapsed: false,
            items :[{
                    fieldLabel: '姓名',
                    name: 'first',
                    allowBlank:false
                },{
					xtype:'radiogroup',
					fieldLabel:'性别',
					name:'sex',
					allowBlank:false,
					items:[
						{boxLabel:'男性',name:'sex',inputValue:1,checked:true},
						{boxLabel:'女性',name:'sex',inputValue:2},
						{boxLabel:'保密',name:'sex',inputValue:3}
					]
				},{
					xtype:'datefield',
					fieldLabel:'年龄',
					name:'age',
					width:210,
					allowBlank:false
				},{
					xtype:'combo',
					fieldLabel:'民族',
					hiddenName:'nation',
					store:new Ext.data.SimpleStore({
						fields:['abbr','state'],
						data:Ext.nationdata.chinenations
					}),
					    valueField:'abbr',
                        displayField:'state',
                        typeAhead: true,
                        mode: 'local',
                        triggerAction: 'all',
                        emptyText:'选择民族',
                        selectOnFocus:true,
                        width:210
				},
				 new Ext.form.ComboBox({
                        fieldLabel: '籍贯',
                        hiddenName:'state',
                        store: new Ext.data.SimpleStore({
                            fields: ['abbr', 'state'],
                            data : Ext.exampledata.chinastates // from states.js
                        }),
                        valueField:'abbr',
                        displayField:'state',
                        typeAhead: true,
                        mode: 'local',
                        triggerAction: 'all',
                        emptyText:'选择省份',
                        selectOnFocus:true,
                        width:210
                    }),
				{
                    fieldLabel: '家庭',
                    name: 'company'
                }, {
                    fieldLabel: '邮箱',
                    name: 'email',
                    vtype:'email'
                }
            ]
        },{
            xtype:'fieldset',
            title: '身心发展数据',
            collapsible: true,
            autoHeight:true,
            defaults: {width: 210},
            defaultType: 'textfield',
            items :[{
                    fieldLabel: '身高',
                    name: 'home',
                    value: 'cm'
                },{
                    fieldLabel: '体重',
                    name: 'business'
                },{
                    fieldLabel: '胸围',
                    name: 'mobile'
                },{
                    fieldLabel: '近视眼度数',
                    name: 'fax'
                }
            ]
        },{
            xtype:'fieldset',
            title: '劳动力数据',
            collapsible: true,
            autoHeight:true,
            defaults: {width: 210},
            defaultType: 'textfield',
            items :[{
                    fieldLabel: '就业单位',
                    name: 'employee',
                    value: '北京青年政治学院'
                },{
                    fieldLabel: '就业单位性质',
                    name: 'business'
                },{
                    fieldLabel: '个人技术等级',
                    name: 'mobile'
                },{
                    fieldLabel: '参加职业技能次数',
                    name: 'fax'
                }
            ]
        }
		
		
		],

        buttons: [{
            text: 'Save'
        },{
            text: 'Cancel'
        }]
    });

    fsf.render(document.body);


});